
import java.awt.Graphics;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JPanel;

/**
 *
 * @author Administrator
 */
public class panelDraw extends JPanel {

    int standardHeight = 400;//最高块的高度
    int standardWidth = 639;
    int size = stSearch.size;
    int perSize = standardWidth / size;//每个块的宽度
    int maxSize = stSearch.getMaxList();

    //double ratioHeight;
    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;

        // draw a rectangle
        for (int i = 0; i < stSearch.listDate.size(); i++) {
            int sum = stSearch.listSum.get(i);
            double height = (sum *standardHeight)/ maxSize;
            double width = perSize;
            double leftX =i * (width); 
            double topY = standardHeight - height;
            System.out.println(topY);
            Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height);
            g2.draw(rect);
        }

    }
}
    
